﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Besture.Common.Definition;
using Besture.Utils;
using Besture.Bll;
using Besture.Model;
using System.Data;

namespace Besture.UI.Master
{
    public partial class MasterBody : System.Web.UI.MasterPage
    {
        public string _txtBlogging = "";
        public string _txtSina = "";
        public string _txtQQ = "";
        public string _userName = "";
        public string _MicroChannel = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            InitData();
            if (Session[Constants.SESSION_KEY_LOGIN_USER] != null)
            {
                _userName = (Session[Constants.SESSION_KEY_LOGIN_USER] as UserModel).NickName;
                noLoginDisplay.Visible = false;
                loginDisplay.Visible = true;
            }
            else
            {
                noLoginDisplay.Visible = true;
                loginDisplay.Visible = false;
            }
            string curUrl = Request.Url.LocalPath.ToLower();
            if (curUrl.Contains("/member/") && Session[Constants.SESSION_KEY_LOGIN_USER] == null)
            {
                Fun.Alert("请先登录！", "/Land/Land.aspx");
            }
        }

        public void InitData()
        {
            ActiveNewsClassDac dac = new ActiveNewsClassDac();
            DataTable dt = dac.GetDataTable(Constants.DICTIONARY_Code_NewsClassEd);
            rbMeList.DataSource = dt;
            rbMeList.DataBind();

            ShortContentDac shortContentDac = new ShortContentDac();
            _txtBlogging = shortContentDac.GetContent("Blogging").EntryValue;
            _txtSina = shortContentDac.GetContent("Sina").EntryValue;
            _txtQQ = shortContentDac.GetContent("QQ").EntryValue;
            labICP.Text = shortContentDac.GetContent("ICP").EntryValue;
            _MicroChannel = shortContentDac.GetContent("MicroChannel").EntryValue;
        }
    }
}